package fr.enseirbmatmeca.apms.spring.model.project;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.hibernate.annotations.GenericGenerator;

/**
* Project is a structure representing a single project as a name and its description
* @author coudar
*/

@Entity
public class Project {

	@NonVisual
    private String id;
    private String name;
    private String description;
    private String tags; //tags are separed with ;
    private List<UploadedFile> jointFiles;

    public String getDescription() {
		return description;
	}

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(unique = true, nullable = false)
    public String getId() {
        return this.id;
    }

    @OneToMany(targetEntity=UploadedFile.class, mappedBy="id", fetch=FetchType.LAZY)
	public List<UploadedFile> getJointFiles() {
		return jointFiles;
	}

    @Column(nullable = false)
    public String getName() {
        return name;
    }

	@Column
	public String getTags() {
		return tags;
	}

	@Column
	public void setDescription(String description) {
		this.description = description;
	}

	public void setId(String id) {
        this.id = id;
    }

	public void setJointFiles(List<UploadedFile> jointFiles) {
		this.jointFiles = jointFiles;
	}

	public void setName(String name) {
        this.name = name;
    }

	public void setTags(String tags) {
		this.tags = tags;
	}
}
